/*
@author Aurelien Deharbe

This file is part of Cute-Client.

Cute-Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Cute-Client is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Cute-Client.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.cuteserver.client.examples;

import com.cuteserver.client.CSClient;
import com.cuteserver.client.CSException;
import com.cuteserver.client.CSICallback;
import com.cuteserver.client.CSSession;

public class Example05Cli2a implements CSICallback {

	private static CSSession s;
	
	public static void main(String[] args)
	{
		try {
			CSClient c = new CSClient("localhost", 5000);
			s = c.joinSession("example05");
			
			s.registerCallback("<sendbtn>", "clicked", new Example05Cli2a());
			
			s.mainloop();
		}
		catch(CSException e) {
			e.print();
		}
	}

	public void callback(String sender, Object[] args) {
		try {
			Object[] data = s.getDataTab("<data>");
			for (int i = 0 ; i < 10 ; i++) {
				System.out.print(data[i] + ", ");
			}
			System.out.println();
		}
		catch(CSException e) {
			e.print();
		}
	}
}
